<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:util="http://www.springframework.org/schema/util"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">

	<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
		p:driverClass="${db.driver}" p:jdbcUrl="${db.url}" p:user="${db.username}"
		p:password="${db.password}" p:maxPoolSize="50" p:minPoolSize="1"
		p:testConnectionOnCheckout="true" p:checkoutTimeout="5000"
		p:maxStatements="500" p:idleConnectionTestPeriod="300"
		p:acquireIncrement="2" />

	<bean id="entityManagerFactory"
		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
		p:dataSource-ref="dataSource" p:persistenceProviderClass="org.hibernate.ejb.HibernatePersistence">
		<property name="jpaVendorAdapter">
			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
				p:generateDdl="true" p:showSql="true" p:databasePlatform="org.hibernate.dialect.SQLServerDialect" />
		</property>
		<property name="packagesToScan">
			<array>
				<value>org.meruvian.yama.security.user</value>
				<value>org.meruvian.yama.persistence</value>
			</array>
		</property>
	</bean>

	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
		p:entityManagerFactory-ref="entityManagerFactory" />

	<tx:annotation-driven />
</beans>
